<template>
  <div id="nav">
    App
  </div>
  <p>{{$store.state.name}}</p>
  <p>{{$store.getters.newName}}</p>
  <button @click="mut">点击</button>
</template>
<script>
import { useStore } from 'vuex'
export default {
  setup () {
    const store = useStore()
    console.log(store.state.name)
    console.log(store.getters.newName)
    // store.commit('updateName')
    const mut = () => {
      // store.commit('updateName')
      store.dispatch('updateName')
    }
    return { mut }
  }
}
</script>

<style lang="less">

</style>
